﻿<!DOCTYPE html>
<html><head><meta charset="UTF-8">
<title></title>

<script>
	onload = function(){
		var box = document.getElementById("box");
		document.onmousemove = function(evt){
			
			var e = evt || event;
			
			box.innerText = "X:"+e.clientX + " Y:"+e.clientY;
			console.log(e.offsetX+","+e.offsetY);
		}
	}
</script>
</head>
<body>
	<div id="box" style="margin:auto; width:100px; height:50px; background:red;"></div>
</body>
</html>